package com.franzliszt.OrderOnline.Activity;

import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;


import com.franzliszt.OrderOnline.SQLite.Dao;
import com.franzliszt.OrderOnline.tool.GoodsList;
import com.franzliszt.OrderOnline.util.ChartTool;
import com.franzliszt.OrderOnline.util.KillProcess;
import com.franzliszt.OrderOnline.util.SP;
import com.franzliszt.hospitalnumberingsystem.R;

import com.franzliszt.hospitalnumberingsystem.util.Param;

import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.formatter.ValueFormatter;

import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;

import lecho.lib.hellocharts.formatter.ColumnChartValueFormatter;
import lecho.lib.hellocharts.formatter.SimpleColumnChartValueFormatter;
import lecho.lib.hellocharts.gesture.ZoomType;
import lecho.lib.hellocharts.model.Axis;
import lecho.lib.hellocharts.model.AxisValue;
import lecho.lib.hellocharts.model.Column;
import lecho.lib.hellocharts.model.ColumnChartData;
import lecho.lib.hellocharts.model.SubcolumnValue;
import lecho.lib.hellocharts.model.Viewport;
import lecho.lib.hellocharts.view.ColumnChartView;


public class HistoricalDataActivity extends AppCompatActivity {
    private Context context = null;
    private KillProcess killProcess;
    private Dao dao;
    private TextView other;
    private ColumnChartView columnChartView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate( savedInstanceState );
        if (Build.VERSION.SDK_INT >= 21) {
            View decorView = getWindow().getDecorView();
            decorView.setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE );
            getWindow().setStatusBarColor( Color.TRANSPARENT );
        }
        setContentView( R.layout.activity_historical_data );
        InitView();
        InitChartViews();
    }
    private void InitView(){
        other = findViewById(R.id.exchangeFunc);
        columnChartView = findViewById(R.id.chart);
        other.setVisibility(View.GONE);
        if (context == null){
            context = HistoricalDataActivity.this;
        }
        killProcess =KillProcess.getInstance();
        killProcess.addActivity( HistoricalDataActivity.this );
        dao = new Dao(HistoricalDataActivity.this);
    }
    public void Exit(View view){
        startActivity( new Intent( context, FunctionActivity.class ) );
    }


    private void InitChartViews(){
        ChartTool tool = new ChartTool();
        tool.Init(HistoricalDataActivity.this);
        tool.setChartViewData(columnChartView);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }
}
